<template>
  <DIV v-loading="loading">
    <el-col :span="24" class="content_title clearfix">
      <el-col :span="12">
        <HeadTitle></HeadTitle>
      </el-col>
      <el-col :span="12">
         <!-- v-if="is_open_edit === 1" -->
        <el-button :loading="$store.state.isLoading" @click="add_rank_btn()" type="primary" style="margin-right: 50px" size="small" class="f_r">添加 </el-button>
      </el-col>
    </el-col>
    <div class="user_rank">
      <div class="user_rank_part" :style="{ 'padding-top': i == 1 ? ' 90px' : '' }" v-for="(item, i) in rank_list" :key="item.id" v-show="item.id != 0">
        <div class="user_rank_item1">
          <div :class="{ rank_item1_left: i > 0 }" style="width: 35%">
            <div class="item1_left_top">
              <p class="item_title">等级信息</p>
              <div class="item_btn">
                <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_rankinfo_btn(item.id)">编辑</el-button>
                <el-button :loading="$store.state.isLoading" type="info" size="small" @click="went_rank(item.id)">查看会员</el-button>
                <!-- && is_open_edit === 1 -->
                <el-button :loading="$store.state.isLoading" v-if="item.id != 1 " size="small" type="danger" @click="del_rank(item.id)">删除等级 </el-button>
              </div>
            </div>
            <div class="item1_left_bottom">
              <div class="item1_left_bottom_item">
                <div class="item1_left_bottom_item_img">
                  <img src="./../../assets/img/rank2.png" alt />
                </div>
                <div class="item1_left_bottom_item_content">
                  <p>{{ item.title }} ID:{{item.id}}</p>
                  <span>等级名称</span>
                </div>
              </div>
              <div class="item1_left_bottom_item">
                <div class="item1_left_bottom_item_img">
                  <img src="./../../assets/img/rank1.png" alt />
                </div>
                <div class="item1_left_bottom_item_content">
                  <p>{{ item.discount }}</p>
                  <span>消费折扣</span>
                </div>
              </div>
            </div>
          </div>
          <div class="rank_item1_right" v-if="i > 0">
            <div class="item1_left_top">
              <p class="item_title">等级条件</p>
              <div class="item_btn">
                <el-button :loading="$store.state.isLoading" v-if="item.id != 1" type="primary" size="small" @click="edit_condition_btn(item.id)">编辑 </el-button>
              </div>
            </div>
            <div class="item1_right_bottom">
              <span v-if="parseInt(item.zt_num) != 0">直推有效人数：{{ item.zt_num }}人</span>
              <span v-if="parseInt(item.out_num) != 0">组队出局次数：{{ item.out_num }}次</span>
              <span v-if="parseInt(item.lock_money_buy) != 0">小区业绩：>= {{ item.lock_money_buy }}</span>
              <span v-if="parseInt(item.td_num) != 0">团队会员人数：{{ item.td_num }}人</span>
              <span v-if="parseInt(item.direct_rating_number) != 0 && item.direct_rating != 0">直推指定{{ item.direct_rating_cn }}等级人数：{{ item.direct_rating_number }}人</span>
              <span v-if="parseInt(item.shop_buy) != 0">自身持有：{{ item.shop_buy | retain_two }}元</span>
              <span v-if="parseInt(item.assign_buy) != 0">累计会员商品消费额：{{ item.assign_buy | retain_two }}元</span>
              <span v-if="parseInt(item.recharge) != 0">总充值额：{{ item.recharge | retain_two }}元</span>
<!--              <span v-if="parseInt(item.td_shop_buy) != 0">团队业绩：{{ item.td_shop_buy | retain_two }}元</span>-->
              <span v-if="parseInt(item.td_assign_buy) != 0">团队会员商品总消费额：{{ item.td_assign_buy | retain_two }}元</span>
              <span v-if="item.id != 1 && item.highest > 0">一次性最高消费会员商品{{ item.highest | retain_two }}元</span>
              <span v-if="Number(item.zt_shop_buy) > 0">直推商城消费总额{{ item.zt_shop_buy | retain_two }}元</span>
              <span v-if="Number(item.zt_assign_buy) > 0">直推会员商城消费总额{{ item.zt_assign_buy | retain_two }}元</span>
              <span v-if="Number(item.discuss) > 0 &&        $store.state.plugin &&
                    $store.state.plugin.sxy &&
                    $store.state.plugin.sxy.is_open == 1 ">商学院考试分数：{{ Number(item.discuss) }}</span>

              <span v-if="Number(item.subgroup_number) > 0">推荐进入副群人数：{{ item.subgroup_number  }}</span>
              <span v-if="Number(item.host_level) > 0">主群层数：{{ item.host_level  }}</span> 
              <span v-if="Number(item.assistant_level) > 0">我之后进群消费人数：{{ item.assistant_level  }}</span>
            </div>
          </div>
        </div>
 <!--       <div class="user_rank_item2" v-if="is_open.tyxfx && is_open.tyxfx.is_open != 0">
          <div class="item2_top">
            <p class="item_title">分销模块</p>
            <div class="item_btn">
              <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_sale_btn(item)"> 编辑 </el-button>
            </div>
          </div>
          <div class="item2_content">
            <p v-for="(dist, d) in item.distribution" :key="d">
              {{ d + 1 }}级奖:
              <span>{{ dist.reward }}‰</span>
              <span>{{ dist.account_cn }}</span>
            </p>
          </div>
        </div>
		 -->
        <div class="user_rank_item2" v-if="is_open.sgzfx && is_open.sgzfx.is_open != 0">
          <div class="item2_top">
            <p class="item_title">团队奖励</p>
            <div class="item_btn">
              <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_reward_btn(item.id)">编辑</el-button>
            </div>
          </div>
          <div class="item2_content">
            <p>
              团队奖励:
              <span>{{ item.team }}‰</span>
            </p>
            <p>
              一级平级奖:
              <span>{{ item.team_same }}‰</span>
            </p>
            <p>
              二级平级奖:
              <span>{{ item.team_same_1 }}‰</span>
            </p>
            <p>
              账户奖励:
              <span>{{ item.team_account_cn }}</span>
            </p>
          </div>
        </div>

        <div class="user_rank_item2" v-if="is_open.fhfx && is_open.fhfx.is_open != 0">
          <div class="item2_top">
            <p class="item_title">分红模块</p>
            <div class="item_btn">
              <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_dividend_btn(item.id)">编辑</el-button>
            </div>
          </div>
          <div class="item2_content">
            <p>
              股东分红:
              <span>{{ item.dividend }}‰ &nbsp;&nbsp;</span>
            </p>
            <p>
              分红方式:
              <span>{{ setFh(item.dividend_types) }}</span>
            </p>
            <p>
              结算周期:
              <span v-if="item.dividend_cycle == 0">时</span>
              <span v-if="item.dividend_cycle == 1">日</span>
              <span v-if="item.dividend_cycle == 2">周</span>
              <span v-if="item.dividend_cycle == 3">月</span>
            </p>
            <p>
              账户奖励:
              <span>{{ item.dividend_account_cn }}</span>
            </p>
            <p>
              分红封顶:
              <span>{{ item.dividend_capped }}‰</span>
            </p>
          </div>
        </div>

        <div class="user_rank_item2">
          <div class="item2_top">
            <p class="item_title">商城板块奖励</p>
            <div class="item_btn">
              <el-button :loading='$store.state.isLoading' type="primary" size="small" @click="edit_dz1_btn(item.id)">编辑
              </el-button>
            </div>
          </div>
          <div class="item2_content">
            <p>
              直推奖:
              <span>{{ item.scbk_ztj }}‰</span>
            </p>
            <p>
              分红奖:
              <span>{{ item.scbk_fhj }}‰</span>
            </p>
            <!-- <p>
              间推奖:
              <span>{{ item.scbk_jtj }}‰</span>
            </p>
            <p>
              团队奖:
              <span>{{ item.scbk_tdj }}‰</span>
            </p>
            <p>
              平级奖1:
              <span>{{ item.scbk_pjj1 }}‰</span>
            </p>
            <p>
              平级奖2:
              <span>{{ item.scbk_pjj2 }}‰</span>
            </p>
            <p>
              平级奖3:
              <span>{{ item.scbk_pjj3 }}‰</span>
            </p>
            <p>
              平级奖4:
              <span>{{ item.scbk_pjj4 }}‰</span>
            </p>
            <p>
              平级奖5:
              <span>{{ item.scbk_pjj5 }}‰</span>
            </p> -->

          </div>
        </div>
		<div class="user_rank_item2">
		  <div class="item2_top">
		    <p class="item_title">锁仓券板块奖励</p>
		    <div class="item_btn">
		      <el-button :loading='$store.state.isLoading' type="primary" size="small" @click="edit_lock_btn(item.id)">编辑
		      </el-button>
		    </div>
		  </div>
		  <div class="item2_content">
		    <p>
		      直推奖:
		      <span>{{ item.qy_ztj }}‰</span>
		    </p>
		    <p>
		      团队奖:
		      <span>{{ item.qy_tdj }}‰</span>
		    </p>
		    <p>
		      平级奖:
		      <span>{{ item.qy_pjj }}‰</span>
		    </p>
		
		  </div>
		</div>
<!-- 
        <div class="user_rank_item2">
          <div class="item2_top">
            <p class="item_title">补贴权益奖励</p>
            <div class="item_btn">
              <el-button :loading='$store.state.isLoading' type="primary" size="small" @click="edit_dz2_btn(item.id)">编辑
              </el-button>
            </div>
          </div>
          <div class="item2_content">
            <p>
              直推奖:
              <span>{{ item.btqy_ztj }}‰</span>
            </p>
            <p>
              间推奖:
              <span>{{ item.btqy_jtj }}‰</span>
            </p>
            <p>
              团队奖:
              <span>{{ item.btqy_tdj }}‰</span>
            </p>
            <p>
              平级奖1:
              <span>{{ item.btqy_pjj1 }}‰</span>
            </p>
            <p>
              平级奖2:
              <span>{{ item.btqy_pjj2 }}‰</span>
            </p>
            <p>
              平级奖3:
              <span>{{ item.btqy_pjj3 }}‰</span>
            </p>
            <p>
              平级奖4:
              <span>{{ item.btqy_pjj4 }}‰</span>
            </p>
            <p>
              平级奖5:
              <span>{{ item.btqy_pjj5 }}‰</span>
            </p>
          </div>
        </div> -->

      <!--  <div class="user_rank_item2">
          <div class="item2_top">
            <p class="item_title">认筹租赁奖励</p>
            <div class="item_btn">
              <el-button :loading='$store.state.isLoading' type="primary" size="small" @click="edit_dz3_btn(item.id)">编辑
              </el-button>
            </div>
          </div>
          <div class="item2_content">
            <p>
              直推奖:
              <span>{{ item.rczl_ztj }}‰</span>
            </p>
            <p>
              间推奖:
              <span>{{ item.rczl_jtj }}‰</span>
            </p>
            <p>
              团队奖:
              <span>{{ item.rczl_tdj }}‰</span>
            </p>
            <p>
              平级奖1:
              <span>{{ item.rczl_pjj1 }}‰</span>
            </p>
            <p>
              平级奖2:
              <span>{{ item.rczl_pjj2 }}‰</span>
            </p>
            <p>
              平级奖3:
              <span>{{ item.rczl_pjj3 }}‰</span>
            </p>
            <p>
              平级奖4:
              <span>{{ item.rczl_pjj4 }}‰</span>
            </p>
            <p>
              平级奖5:
              <span>{{ item.rczl_pjj5 }}‰</span>
            </p>
          </div>
        </div> -->
		
	  </div>
    </div>
    <!--        添加会员等级-->
    <el-dialog title="添加会员等级" class="tl size_13" :visible.sync="add_rank_show" width="800px" :close-on-click-modal="false">
      <el-form ref="form" :model="add_form" :label-position="'right'" label-width="120px">
        <el-form-item label="等级名称:" prop="title">
          <el-col :span="12">
            <el-input placeholder v-model="add_form.title" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" type="primary" @click="add_rank(add_form)">确 定</el-button>
          <el-button :loading="$store.state.isLoading" @click="add_rank_show = false">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--        编辑等级信息-->
    <el-dialog title="编辑等级条件" class="tl size_13" :visible.sync="edit_rankinfo_show" width="800px" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="120px">
        <el-form-item label="等级名称:" prop="title">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.title" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="消费折扣:" prop="discount">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.discount" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" type="primary" @click="edit_rankinfo(edit_data)">确 定</el-button>
          <el-button :loading="$store.state.isLoading" @click="edit_rankinfo_show = false">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--        编辑等级条件-->
    <el-dialog title="编辑等级条件" :visible.sync="edit_condition_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="170px">
       <!-- <el-form-item label="自身持有:" prop="shop_buy">
          <el-col :span="12"> 
            <el-input placeholder v-model="edit_data.shop_buy" clearable></el-input>
          </el-col>
        </el-form-item> -->
       <!-- <el-form-item label="直推有效人数:" prop="zt_num">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.zt_num" clearable></el-input>
          </el-col>
        </el-form-item> -->
      <!--  <el-form-item label="组队出局次数:" prop="out_num">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.out_num" clearable></el-input>
          </el-col>
        </el-form-item> -->
        <el-form-item label="小区业绩:" prop="lock_money_buy">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.lock_money_buy" clearable></el-input>
          </el-col>
        </el-form-item>

<!--        <el-form-item label="团队业绩:" prop="td_shop_buy">-->
<!--          <el-col :span="12">-->
<!--            <el-input placeholder v-model="edit_data.td_shop_buy" clearable></el-input>-->
<!--          </el-col>-->
<!--        </el-form-item>-->
<!-- 
        <el-form-item label="直推指定会员等级:" prop="direct_rating">
          <el-col :span="12">
            <el-select v-model="edit_data.direct_rating" placeholder="请选择" style="width: 100%">
              <el-option v-for="d in rank_list" :key="d.id" :label="d.title" :value="d.id"></el-option>
            </el-select>
          </el-col>
        </el-form-item>

        <el-form-item label="直推指定会员等级人数:" prop="direct_rating_number">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.direct_rating_number" clearable></el-input>
          </el-col>
        </el-form-item> -->
       
        <!-- <el-form-item label="团队会员人数:" prop="td_num">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.td_num" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="累计会员商品消费额:" prop="assign_buy">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.assign_buy" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="总充值额:" prop="recharge">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.recharge" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="团队会员商品总消费额:" prop="td_assign_buy">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.td_assign_buy" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="一次性最高消费会员商品:" prop="td_assign_buy">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.highest" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="直推商城消费总额:" prop="td_assign_buy">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.zt_shop_buy" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="直推会员商城消费总额:" prop="td_assign_buy">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.zt_assign_buy" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商学院考试分数:" prop="discuss" v-if="
                    $store.state.plugin &&
                    $store.state.plugin.sxy &&
                    $store.state.plugin.sxy.is_open == 1 
                  ">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.discuss" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="推荐进入副群人数:" prop="subgroup_number">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.subgroup_number" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="主群层数:" prop="host_level">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.host_level" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="我之后进群消费人数:" prop="assistant_level">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.assistant_level" clearable></el-input>
          </el-col>
        </el-form-item> -->
        <el-form-item>
          <el-button :loading="$store.state.isLoading" type="primary" @click="edit_condition(edit_data)">确 定</el-button>
          <el-button :loading="$store.state.isLoading" @click="edit_condition_show = false">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--        编辑分销模块-->
    <el-dialog title="编辑分销模块" :visible.sync="edit_sale_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form label-position="100px">
        <el-form-item style="margin: 0" v-for="(item, i) in distribution" :key="i" :label="i + 1 + '级奖：'" class="distribution">
          <el-col :span="6">
            <el-input placeholder v-model="item.reward" clearable size="small">
              <span slot="append">‰</span>
            </el-input>
          </el-col>
          <el-col :span="3" class="tr" style="padding: 0 12px 0 0"> 奖励账户： </el-col>
          <el-col :span="6">
            <el-select v-model="item.account" placeholder="请选择" size="small">
              <el-option v-for="d in sel_option" :key="d.value" :label="d.label" :value="d.value"></el-option>
            </el-select>
          </el-col>
          <el-col :span="6" style="padding: 0 0 0 16px">
            <!-- <el-button :loading="$store.state.isLoading" type="primary" icon="el-icon-edit-outline" @click="editItem(i)" size="small"
                v-if="item.id && !item.show">
              编辑
            </el-button> -->
            <!-- <el-button :loading="$store.state.isLoading" type="success" icon="el-icon-edit-outline" @click="saveItem(item, i)" size="small"
                v-if="item.show">
              保存
            </el-button> -->
            <el-button :loading="$store.state.isLoading" type="danger" icon="el-icon-delete" @click="delItem(i, item)" size="small">删除</el-button>
          </el-col>
        </el-form-item>

        <div class="tc" style="margin-top: 20px">
          <el-button :loading="$store.state.isLoading" type="warning" size="small" @click="addItem"> 添 加 </el-button>

          <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="saveall_distribution"> 全部保存 </el-button>
        </div>
      </el-form>
    </el-dialog>
    <!--        编辑团队奖励-->
    <el-dialog title="编辑团队奖励" :visible.sync="edit_reward_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="120px" style>
        <el-form-item label="团队奖励:" prop="team">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.team" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="一级平级奖:" prop="team_same">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.team_same" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="二级平级奖:" prop="team_same_1">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.team_same_1" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="账户奖励:" prop="team_account">
          <el-col :span="12">
            <el-select v-model="edit_data.team_account" placeholder="请选择" style="width: 100%">
              <el-option v-for="y in sel_option" :key="y.value" :label="y.label" :value="y.value"></el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" type="primary" @click="edit_reward(edit_data)">确 定</el-button>
          <el-button :loading="$store.state.isLoading" @click="edit_reward_show = false">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--        编辑分红模块-->
    <el-dialog title="编辑分红模块" :visible.sync="edit_dividend_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="120px">
        <el-form-item label="股东分红:" prop="dividend">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.dividend" clearable></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="结算周期:" prop="dividend_cycle">
          <el-col :span="12">
            <el-select v-model="edit_data.dividend_cycle" placeholder="请选择" style="width: 100%">
              <el-option v-for="i in accounts_option" :key="i.val" :label="i.label" :value="i.val"></el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <el-form-item label="账户奖励:" prop="dividend_account">
          <el-col :span="12">
            <el-select v-model="edit_data.dividend_account" placeholder="请选择" style="width: 100%">
              <el-option v-for="y in sel_option" :key="y.value" :label="y.label" :value="y.value"></el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <el-form-item label="分红方式:" prop="dividend_account">
          <el-col :span="12">
            <el-select v-model="edit_data.dividend_types" placeholder="请选择" style="width: 100%">
              <el-option v-for="y in dividend_types" :key="y.value" :label="y.label" :value="y.value"></el-option>
            </el-select>
          </el-col>
        </el-form-item>
        <el-form-item label="分红封顶:" prop="dividend">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.dividend_capped" clearable>
              <template slot="append">‰</template>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-col :span="24" style="margin-top: -20px">分红根据累计消费千分币封顶，如果填0表示不封顶</el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" type="primary" @click="edit_dividend(edit_data)">确 定</el-button>
          <el-button :loading="$store.state.isLoading" @click="edit_dividend_show = false">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!--定制1-->
    <el-dialog title="编辑商城板块奖励" :visible.sync="edit_dz1_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="160px">
        <el-form-item label="商城板块-直推奖:" prop="scbk_ztj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_ztj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
		<el-form-item label="商城板块-间推奖:" prop="scbk_fhj">
		   <el-col :span="12">
		     <el-input placeholder v-model="edit_data.scbk_fhj" clearable>
		       <span slot="append">‰</span>
		     </el-input>
		   </el-col>
		 </el-form-item>
       <!-- <el-form-item label="商城板块-间推奖:" prop="scbk_jtj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_jtj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-团队奖:" prop="scbk_tdj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_tdj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖1:" prop="scbk_pjj1">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj1" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖2:" prop="scbk_pjj2">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj2" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖3:" prop="scbk_pjj3">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj3" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖4:" prop="scbk_pjj4">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj4" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖5:" prop="scbk_pjj5">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj5" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item> -->
        <el-form-item>
          <el-button :loading="$store.state.isLoading" @click="edit_dz1_show = false" size="small">取 消</el-button>
          <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_dz1(edit_data)">确 定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!--定制3-->
    <el-dialog title="编辑锁仓板块奖励" :visible.sync="edit_lock_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="160px">
        <el-form-item label="锁仓板块-直推奖:" prop="qy_ztj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.qy_ztj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
		<el-form-item label="锁仓板块-团队奖:" prop="qy_tdj">
		   <el-col :span="12">
		     <el-input placeholder v-model="edit_data.qy_tdj" clearable>
		       <span slot="append">‰</span>
		     </el-input>
		   </el-col>
		 </el-form-item>
		<el-form-item label="锁仓板块-平级奖:" prop="qy_pjj">
		   <el-col :span="12">
		     <el-input placeholder v-model="edit_data.qy_pjj" clearable>
		       <span slot="append">‰</span>
		     </el-input>
		   </el-col>
		 </el-form-item>
       <!-- <el-form-item label="商城板块-间推奖:" prop="scbk_jtj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_jtj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-团队奖:" prop="scbk_tdj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_tdj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖1:" prop="scbk_pjj1">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj1" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖2:" prop="scbk_pjj2">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj2" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖3:" prop="scbk_pjj3">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj3" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖4:" prop="scbk_pjj4">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj4" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="商城板块-平级奖5:" prop="scbk_pjj5">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.scbk_pjj5" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item> -->
        <el-form-item>
          <el-button :loading="$store.state.isLoading" @click="edit_dz1_show = false" size="small">取 消</el-button>
          <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_dz1(edit_data)">确 定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!--定制2-->
    <el-dialog title="编辑补贴权益奖励" :visible.sync="edit_dz2_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="160px">
        <el-form-item label="补贴权益-直推奖:" prop="btqy_ztj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_ztj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="补贴权益-间推奖:" prop="btqy_jtj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_jtj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="补贴权益-团队奖:" prop="btqy_tdj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_tdj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
       <!-- <el-form-item label="补贴权益-贡献值:" prop="btqy_gxz">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_gxz" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item> -->
        <el-form-item label="补贴权益-平级奖1:" prop="btqy_pjj1">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_pjj1" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="补贴权益-平级奖2:" prop="btqy_pjj2">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_pjj2" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="补贴权益-平级奖3:" prop="btqy_pjj3">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_pjj3" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="补贴权益-平级奖4:" prop="btqy_pjj4">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_pjj4" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="补贴权益-平级奖5:" prop="btqy_pjj5">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.btqy_pjj5" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" @click="edit_dz2_show = false" size="small">取 消</el-button>
          <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_dz2(edit_data)">确 定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
    <!--定制3-->
    <el-dialog title="编辑认筹租赁奖励" :visible.sync="edit_dz3_show" width="800px" class="tl size_13" :close-on-click-modal="false">
      <el-form ref="form" :model="edit_data" :label-position="'right'" label-width="160px">
        <el-form-item label="认筹租赁-直推奖:" prop="rczl_ztj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_ztj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="认筹租赁-间推奖:" prop="rczl_jtj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_jtj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="认筹租赁-团队奖:" prop="rczl_tdj">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_tdj" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="认筹租赁-平级奖1:" prop="rczl_pjj1">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_pjj1" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="认筹租赁-平级奖2:" prop="rczl_pjj2">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_pjj2" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="认筹租赁-平级奖3:" prop="rczl_pjj3">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_pjj3" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="认筹租赁-平级奖4:" prop="rczl_pjj4">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_pjj4" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="认筹租赁-平级奖5:" prop="rczl_pjj5">
          <el-col :span="12">
            <el-input placeholder v-model="edit_data.rczl_pjj5" clearable>
              <span slot="append">‰</span>
            </el-input>
          </el-col>
        </el-form-item>
        <el-form-item>
          <el-button :loading="$store.state.isLoading" @click="edit_dz3_show = false" size="small">取 消</el-button>
          <el-button :loading="$store.state.isLoading" type="primary" size="small" @click="edit_dz3(edit_data)">确 定</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </DIV>
</template>

<script>
import HeadTitle from "@/components/currency/HeadTitle.vue";
export default {
  name: "user_rank",
  components: {
    HeadTitle,
  },
  data() {
    return {
      is_open_edit: null, //是否允许 添加删除等级
      is_upgrade: 0,
      is_open: [],
      dividend_types: [
        { value: "1", label: "全部商城营业额分红" },
        { value: "2", label: "普通商城营业额分红" },
        { value: "3", label: "会员商城营业额分红" },
        { value: "4", label: "全部商城利润分红" },
        { value: "5", label: "普通商城利润分红" },
        { value: "6", label: "会员商城利润分红" },
      ],
      edit_id: "",
      edit_data: {},
      ratings: [],
      edit_dividend_show: false, //编辑分红模块
      edit_reward_show: false, //编辑团队奖励
      edit_sale_show: false, //编辑分销模块
      edit_condition_show: false, //编辑等级条件
      edit_rankinfo_show: false, //编辑等级信息
      edit_dz1_show: false, //定制1模块
      edit_dz2_show: false, //定制2模块
      edit_dz3_show: false, //定制3模块
	  edit_lock_show:false,
      sel_option: this.$store.state.rewardOption || [],
      add_form: {
        title: "", //名称
        discount: "", //折扣
        zt_num: "", //直推有效人数
        td_num: "", //团队会员人数
		lock_money_buy:"",
        direct_rating: "0", //直推指定会员等级
        direct_rating_number: "", //直推指定会员等级人数
        shop_buy: "", //累计商城总消费额
        assign_buy: "", //累计会员商品消费额
        recharge: "", //总充值额
        td_shop_buy: "", //团队业绩
        td_assign_buy: "", //团队会员商品总消费额
        level_1: "", //直推奖
        level_2: "", //间推奖
        level_3: "", //三级奖
        level_4: "", //四级奖
        level_5: "", //五级奖
        level_account: "", //分销模块奖励账户
        team: "", //团队奖励
        team_same: "", //平级奖励
        team_account: "", //团队奖励账户
        dividend: "", //股东分红
        dividend_cycle: "", //结算周期 0日1周2月
        dividend_account: "", //股东分红结算账户
      },
      accounts_option: [
        //结算周期
        {
          label: "时",
          val: "0",
        },
        {
          label: "日",
          val: "1",
        },
        {
          label: "周",
          val: "2",
        },
        {
          label: "月",
          val: "3",
        },
      ],
      add_rank_show: false,
      loading: false,
      rank_list: [],
      distribution: [],
    };
  },
  created() {
    this.getupgrade();
    this.get_rank_list();
    this.get_seloption(); //获取浏览器缓存
    this.get_sinle_rank("1");
    this.is_open = JSON.parse(localStorage.getItem("limit"));
    this.$api.getSettings.findConfig({ iden: "is_rating_cz" }).then((res) => {
      if (res.data.code == 200 && res.data.result == 1) {
        this.is_open_edit = 1;
      } else {
        this.is_open_edit = 0;
      }
    });
  },
  methods: {
    saveItem(item, i) {
      if (item.id) {
        this.$api.getUser.distribution_saveedit(item).then((res) => {
          if (res.data.code == 200) {
            this.$fnc.alertSuccess({ text: "修改成功" });
            this.$api.getUser
              .get_singlerank({ id: this.edit_id })
              .then((res2) => {
                if (res2.data.code == 200) {
                  this.edit_sale_btn(res2.data.result);
                  this.get_rank_list();
                }
              });
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      } else {
        item.rating = this.edit_id;
        this.$api.getUser.distribution_saveadd(item).then((res) => {
          if (res.data.code == 200) {
            this.$fnc.alertSuccess({ text: "添加成功" });
            this.$api.getUser
              .get_singlerank({ id: this.edit_id })
              .then((res2) => {
                if (res2.data.code == 200) {
                  this.edit_sale_btn(res2.data.result);
                  this.get_rank_list();
                }
              });
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      }
      // this.edit_sale_show = false;
    },
    editItem(i) {
      this.$set(this.distribution[i], "show", true);
    },
    delItem(i, item) {
      if (item.id) {
        this.$api.getUser.distribution_del({ id: item.id }).then((res) => {
          if (res.data.code == 200) {
            this.$fnc.alertSuccess({ text: "删除成功" });
            this.$api.getUser
              .get_singlerank({ id: this.edit_id })
              .then((res2) => {
                if (res2.data.code == 200) {
                  this.edit_sale_btn(res2.data.result);
                  this.get_rank_list();
                }
              });
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
        // this.edit_sale_show = false;
      } else {
        this.distribution.splice(i, 1);
      }
    },
    saveall_distribution() {
      var flag = true;
      var params = {};
      var n_arr = [];
      this.distribution.forEach((item, i) => {
        console.log(!item.account, item.reward);
        if (!item.account || !item.reward) {
          flag = false;
        }
        n_arr.push({
          id: item.id || 0,
          rating: this.edit_id,
          reward: item.reward,
          account: item.account,
          account_cn: item.account_cn,
        });
      });
      if (flag == false) {
        this.$fnc.alertError("请完善信息");
      } else {
        params.distribution = JSON.stringify(n_arr);
        this.$api.getUser.distribution_saveall(params).then((res) => {
          if (res.data.code == 200) {
            this.$fnc.alertSuccess({ text: "保存成功" });

            this.$api.getUser
              .get_singlerank({ id: this.edit_id })
              .then((res2) => {
                if (res2.data.code == 200) {
                  this.edit_sale_btn(res2.data.result);
                  this.get_rank_list();
                }
              });
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      }
    },
    addItem() {
      this.distribution.push({
        reward: "",
        account: "",
        show: true,
      });
    },
    getupgrade() {
      //会员费管理  如果为1 取消编辑升级调剂
      // this.$api.getSettings.findConfig({ iden: "vip_mode " }).then(res => {
      //   if (res.data.code == 200) {
      //     this.is_upgrade = res.data.result;
      //   }
      // });
    },
    setFh(index) {
      for (var i in this.dividend_types) {
        if (this.dividend_types[i].value == index) {
          return this.dividend_types[i].label;
          break;
        }
      }
    },
    went_rank(rank) {
      //根据等级查看会员

      let routeData = this.$router.resolve({
        path: "./user",
        query: { rating: rank },
      });
      window.open(routeData.href, "_blank");
    },
    edit_dz3(obj) {
      //编辑定制1模块
      obj.id = this.edit_id;
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.get_rank_list();
      this.edit_dz3_show = false;
    },
    edit_dz2(obj) {
      //编辑定制1模块
      obj.id = this.edit_id;
	  console.log("btqy",obj);
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.get_rank_list();
      this.edit_dz2_show = false;
    },
    edit_dz1(obj) {
      //编辑定制1模块
      obj.id = this.edit_id;
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.get_rank_list();
      this.edit_dz1_show = false;
    },
    edit_dz3_btn(id) {
      //显示编辑定制1窗口
      this.edit_id = id;
      this.edit_dz3_show = true;
      this.get_sinle_rank(id);
    },
    edit_dz2_btn(id) {
      //显示编辑定制1窗口
      this.edit_id = id;
      this.edit_dz2_show = true;
      this.get_sinle_rank(id);
    },
    edit_dz1_btn(id) {
      //显示编辑定制1窗口
      this.edit_id = id;
      this.edit_dz1_show = true;
      this.get_sinle_rank(id);
    },
    edit_lock_btn(id) {
      //显示编辑定制1窗口
      this.edit_id = id;
      this.edit_lock_show = true;
      this.get_sinle_rank(id);
    },
	
    edit_dividend(obj) {
      //编辑分红模块
      obj.id = this.edit_id;
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.get_rank_list();
      this.edit_dividend_show = false;
    },
    edit_dividend_btn(id) {
      //显示编辑分红模块窗口
      this.edit_id = id;
      this.edit_dividend_show = true;
      this.get_sinle_rank(id);
    },
    edit_reward(obj) {
      //编辑奖励模块
      obj.id = this.edit_id;
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.edit_reward_show = false;
    },
    edit_reward_btn(id) {
      //显示奖励模块窗口
      this.edit_id = id;
      this.edit_reward_show = true;
      this.get_sinle_rank(id);
    },
    edit_sale(obj) {
      //编辑分销模块
      obj.id = this.edit_id;
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.edit_sale_show = false;
    },
    edit_sale_btn(item) {
      //显示编辑分销模块窗口
      this.edit_id = item.id;
      if (item.distribution && item.distribution.length > 0) {
        this.distribution = JSON.parse(JSON.stringify(item.distribution));
      } else {
        this.distribution = [
          {
            reward: "",
            account: "",
            show: true,
          },
        ];
      }
      this.edit_sale_show = true;
    },
    edit_condition(obj) {
      //编辑等级条件
      obj.id = this.edit_id;
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.edit_condition_show = false;
    },
    edit_condition_btn(id) {
      //显示编辑等级条件窗口
      this.edit_id = id;
      this.edit_condition_show = true;
      this.get_sinle_rank(id);
    },
    edit_rankinfo(obj) {
      //编辑等级信息
      obj.id = this.edit_id;
      this.$api.getUser.edit_rank_save(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.edit_rankinfo_show = false;
    },
    edit_rankinfo_btn(id) {
      //显示编辑等级信息窗口
      this.edit_id = id;
      this.edit_rankinfo_show = true;
      this.get_sinle_rank(id);
    },
    del_rank(id) {
      //删除会员
      this.$swal({
        title: "您确定要删除这条信息吗",
        text: "删除后将无法恢复，请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "是的，我要删除",
        cancelButtonText: "容我三思",
      }).then((willDelete) => {
        if (willDelete.value) {
          this.$api.getUser.del_rank({ id: id }).then((res) => {
            if (res.data.code == 200) {
              this.$fnc.alertSuccess("");
              this.get_rank_list();
            } else {
              this.$fnc.alertError(res.data.result);
              this.get_rank_list();
            }
          });
        }
      });
    },

    add_rank(obj) {
      this.$api.getUser.add_rank(obj).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("");
          this.get_rank_list();
        } else {
          this.$fnc.alertError(res.data.result);
          this.get_rank_list();
        }
      });
      this.add_rank_show = false;
    },
    add_rank_btn(id) {
      //添加会员窗口显示按钮
      this.edit_id = id;
      this.add_rank_show = true;
    },
    get_seloption() {
      var params = {};
      this.$api.getPlugin.rewardOp(params).then((res) => {
        if (res.data.code == 200) {
          // alert(res.data.result);
          this.$store.commit("setRewardOption", res.data.result);
          this.sel_option = this.$store.state.rewardOption;
        } else {
          this.$fnc.alertError(res.data.result);
        }
      });
    },
    get_sinle_rank(id) {
      //得到一个id详情;
      var temp = {};
      this.$api.getUser.get_singlerank({ id: id }).then((res) => {
        if (res.data.code == 200) {
          this.edit_data = res.data.result;
          this.edit_data.shop_buy = parseFloat(this.edit_data.shop_buy).toFixed(
            2
          );
          this.edit_data.assign_buy = parseFloat(
            this.edit_data.assign_buy
          ).toFixed(2);
          this.edit_data.recharge = parseFloat(this.edit_data.recharge).toFixed(
            2
          );
          this.edit_data.td_shop_buy = parseFloat(
            this.edit_data.td_shop_buy
          ).toFixed(2);
          this.edit_data.td_assign_buy = parseFloat(
            this.edit_data.td_assign_buy
          ).toFixed(2);
          this.edit_data.highest = parseFloat(this.edit_data.highest).toFixed(
            2
          );
          this.edit_data.zt_shop_buy = parseFloat(
            this.edit_data.zt_shop_buy
          ).toFixed(2);
          this.edit_data.zt_assign_buy = parseFloat(
            this.edit_data.zt_assign_buy
          ).toFixed(2);
          if (res.data.result.direct_rating == "0") {
            this.$set(this.edit_data, "direct_rating", "");
          }
          delete this.edit_data.distribution;
          this.edit_data.discuss = Number(this.edit_data.discuss || 0);
        } else {
          this.$fnc.alertError("获取详情失败");
        }
      });
    },
    get_rank_list() {
      //获得会员等级列表
      this.$api.getUser.get_rank({}).then((res) => {
        if (res.data.code == 200) {
          this.rank_list = res.data.result;
          this.$store.commit("setRatting", res.data.result);
          this.rank_list.unshift({ id: "0", title: "请选择" });
        }
      });
    },
  },
  filters: {
    retain_two: function (data) {
      //保留两位小数
      return parseFloat(data).toFixed(2);
    },
  },
};
</script>

<style lang="less" scoped>
.user_rank {
  width: 100%;

  /* margin: 60px auto 0 auto; */
}
.user_rank2 {
  width: 98%;
  margin: 20px auto 0 auto;
}
.user_rank_part {
  width: 100%;
  background-color: #ffffff;
  padding: 20px;
  margin-bottom: 20px;
}
.user_rank_item1 {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  border-bottom: 1px solid #eeeeee;
  padding-bottom: 20px;
}

.rank_item1_left {
  width: 35%;
  border-right: 1px solid #eeeeee;
}

/********************标题********************/
.item1_left_top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 5px solid #5aa5eb;
}
.item_title {
  font-size: 15px;
  color: #000000;
  font-weight: bold;
  text-indent: 10px;
}
/*******************************/
.item_btn {
  padding-right: 30px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
}
.item1_left_bottom {
  width: 100%;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  height: auto;
}
.item1_left_bottom_item {
  width: 48%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.item1_left_bottom_item_img {
  width: 80px;
  height: 80px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.item1_left_bottom_item_img img {
  width: 65%;
}
.item1_left_bottom_item_content {
  display: flex;
  height: 50px;
  flex-flow: column;
  justify-content: space-between;
  align-items: flex-start;
}
.item1_left_bottom_item_content p {
  font-size: 18px;
  color: #000;
  font-weight: bold;
}
.item1_left_bottom_item_content span {
  font-size: 15px;
  color: #cccccc;
}
.rank_item1_right {
  width: 64%;
}
.item1_right_bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}
.item1_right_bottom span {
  font-size: 14px;
  color: #fff;
  padding: 5px 10px;
  margin: 10px 10px 5px 10px;
  border-radius: 5px;
}
.item1_right_bottom span:nth-child(odd) {
  background-color: #01b0af;
}
.item1_right_bottom span:nth-child(even) {
  background-color: #25a0ff;
}
/*-------------------------------------------------*/
.user_rank_item2 {
  width: 100%;
  display: flex;
  flex-flow: column;
  justify-content: flex-start;
  border-bottom: 1px solid #eeeeee;
  padding: 20px 0;
}
.item2_top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 5px solid #5aa5eb;
}
.item2_content {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding-top: 15px;
}
.item2_content p {
  display: inline;
  font-size: 14px;

  color: #4c4c4c;
  margin-right: 80px;
}

.item2_content p:nth-of-type(1) {
  text-indent: 18px;
}
.item2_content p span {
  font-size: 14px;
  color: #fd4466;
  padding-left: 5px;
}
/***********************添加弹出窗*******************/
.add_form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.el-form-item {
  margin-right: 40px;
  margin-left: 20px;
}
.el-form--inline .el-form-item {
}
.demo-ruleForm {
  display: flex;
  flex-flow: column;
  justify-content: space-between;
  align-items: center;
}
.demo-ruleForm {
  text-align: right;
}
.demo-ruleForm .el-form--label-left .el-form-item__label {
  text-align: right;
}
.demo-ruleForm .el-form-item__content {
  text-align: left;
}
/deep/.distribution .el-form-item__label {
  width: 70px;
}
</style>
